<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 14274
  Date: 2023/8/8
  Time: 15:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="yema">
    <div class="yema2">
        <ul class="fenye">
            <c:if test="${currentPage>1}">
                <li id="pagePrev" class="fangda2"><span>《</span></li>
                <li id="pageFirst" class="fangda2"><span>首页</span></li>
            </c:if>
            <c:forEach var="pages" begin="${begin}" end="${end}">
                <li <c:if test="${pages == currentPage}">style="background-color: rgb(231,231,231);"</c:if> class="currentPa fangda"><span>${pages}</span></li>
            </c:forEach>
            <c:if test="${currentPage<totalPage}">
                <li id="pageLast" class="fangda2"><span>尾页</span></li>
                <li id="pageNext" class="fangda2"><span>》</span></li>
            </c:if>
            <li><span>${currentPage}/${totalPage}</span></li>
            <span><select id="selectPageSize" onchange="selectupdate()">
                <option>2</option>
                <option>4</option>
                <option>6</option>
                <option>8</option>
                <option>10</option>
            </select></span>
        </ul>

    </div>

</div>
</body>
</html>
<script src="js/jquery-1.12.4.js"></script>
<script>
    //选择每页显示多少条数据
    function selectupdate(){
        var pageSize = $("#selectPageSize").val();
        $("#pagesize").val(pageSize);
        $(".search-form").submit();
    }
    $(function(){
        var currentSize = ${currentSize};
        $("#selectPageSize").val(currentSize);

        var specialty = "${specialty}";
        $("#search-select").val(specialty);

    })


    //分页上下页
    $("#pagePrev").click(function(){
        var pageSize = $("#selectPageSize").val();
        $("#pagesize").val(pageSize);
        $("#page").val(${pager.prev});
        $(".search-form").submit();
    })
    $("#pageFirst").click(function(){
        var pageSize = $("#selectPageSize").val();
        $("#pagesize").val(pageSize);
        $("#page").val(1);
        $(".search-form").submit();
    })
    $(".currentPa").click(function(){
        var pageSize = $("#selectPageSize").val();
        $("#pagesize").val(pageSize);
        var pageNum = $(this).text();
        $("#page").val(pageNum);
        $(".search-form").submit();
    })
    $("#pageLast").click(function(){
        var pageSize = $("#selectPageSize").val();
        $("#pagesize").val(pageSize);
        $("#page").val(${pager.pageCount});
        $(".search-form").submit();
    })
    $("#pageNext").click(function(){
        var pageSize = $("#selectPageSize").val();
        $("#pagesize").val(pageSize);
        $("#page").val(${pager.next});
        $(".search-form").submit();
    })
</script>
